package es.techideas.appsjam;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.LinearLayout;

public class InfoActivity extends Activity{

	private Context context;
	
	private Button info_back;
	
	private Button info_forward;
	
	private LinearLayout info_background;
	
	private int index = 0;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
    	requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.info);
        
        context = getApplicationContext();
        
        initializeView();
    }
    
    private void initializeView() {
    	
    	info_back = (Button) findViewById(R.id.info_back);
    	info_forward = (Button) findViewById(R.id.info_forward);
    	info_background = (LinearLayout) findViewById(R.id.info_image);
    	
    	info_forward.setOnClickListener(new OnClickListener() {
    		
			public void onClick(View v) {
				switch ( index ) {
					case 0 : 
						index = 1;
						info_background.setBackgroundResource(R.drawable.info_paper);
					break;
					case 1 :
						index = 2;
						info_background.setBackgroundResource(R.drawable.info_rebuig);
						break;
					case 2 : 
						index = 3;
						info_background.setBackgroundResource(R.drawable.info_plastics);
						break;
					case 3 : 
						index = 4;
						info_background.setBackgroundResource(R.drawable.info_organica);
						break;
					case 4 : 
						index = 0;
						finish();
						break;
						
					
				}
			}
		});
    	
    	
    	info_back.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				switch ( index ) {
					case 0 : 
						finish();
					break;
					case 1 :
						index = 0;
						info_background.setBackgroundResource(R.drawable.vidre);

						break;
					case 2 : 
						index = 1;
						info_background.setBackgroundResource(R.drawable.info_paper);

						break;
					case 3 : 
						index = 2;
						info_background.setBackgroundResource(R.drawable.info_rebuig);

						break;
					case 4 : 
						index = 3;
						info_background.setBackgroundResource(R.drawable.info_plastics);

						break;
						
					
				}
			}
		});
    }
}
